package reflect;

import java.lang.reflect.Constructor;
import java.lang.reflect.InvocationTargetException;

/**
 * @author wangyingjie
 * @date
 * @remark
 */
@SuppressWarnings("unchecked")
public class ClassDemo {
    public ClassDemo() {
    }

    public static void main(String[] args) throws NoSuchMethodException, IllegalAccessException, InvocationTargetException, InstantiationException {
        Class clazz = ClassDemo.class;
        //对于重载的方法，还需要传入传参
//        Method info = clazz.getMethod("info", String.class);
        Constructor constructor =
                clazz.getConstructor(null);
        Object o = constructor.newInstance();
        System.out.println(o instanceof ClassDemo);
        System.out.println(clazz.isInstance(o));

    }
}
